<template>
  <div class="inline">
    <span @click="open">
      <a v-if="type === 'link'">{{ action.text }}</a>
      <a-button v-else :type="action.config.color">{{ action.text }}</a-button>
    </span>
  </div>
</template>

<script setup>
const props = defineProps(['action', 'type', 'selectedRows', 'extraParams']);
const open = () => {
  window.open(`/api${props.action.config.url}?id=${props.selectedRows?.[0]?.id}`);
}
</script>
